﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Common.Utilities;

namespace Workflows.Components.Entities.Relations.InferredAssociations
{
    [Serializable]
    public struct EntityPartitionAttribute
    {
        private bool _IsExternal;
        private DataProviderType _DbProvider;
        private string _ConnStr;
        private string _SelectSql;
        private string _EntityIDFieldName;
        private string _PartitionAttributeName;
        private SqlDbType _PartitionAttributeDbType;

        public bool IsExternal
        {
            get { return _IsExternal; }
            set { _IsExternal = value; }
        }

        public DataProviderType DbProvider
        {
            get { return _DbProvider; }
            set { _DbProvider = value; }
        }

        public string ConnStr
        {
            get { return _ConnStr; }
            set { _ConnStr = value; }
        }

        public string SelectSql
        {
            get { return _SelectSql; }
            set { _SelectSql = value; }
        }

        public string EntityIDFieldName
        {
            get { return _EntityIDFieldName; }
            set { _EntityIDFieldName = value; }
        }

        public string PartitionAttributeName
        {
            get { return _PartitionAttributeName; }
            set { _PartitionAttributeName = value; }
        }

        public SqlDbType PartitionAttributeDbType
        {
            get { return _PartitionAttributeDbType; }
            set { _PartitionAttributeDbType = value; }
        }

        public EntityPartitionAttribute(
            bool isExternal,
            string attrName,
            DataProviderType dbProvider,
            string connStr,
            string selectSql,
            string entityIDFieldName,
            SqlDbType dbType)
        {
            this._IsExternal = isExternal;
            this._PartitionAttributeName = attrName;
            this._DbProvider = dbProvider;
            this._ConnStr = connStr;
            this._SelectSql = selectSql;
            this._EntityIDFieldName = entityIDFieldName;
            this._PartitionAttributeDbType = dbType;
        }
    }
}
